/*
 * @Author: xiaosihan 
 * @Date: 2024-10-06 16:05:05 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2024-10-06 16:43:54
 */


import { autorun } from "mobx";
import { ReactNode, useEffect, useRef, useState } from "react";
import styles from "./imgItem.module.less";
import updataPNG from "./updata.png";
import { CloseOutlined } from "@ant-design/icons";

interface Iprops {
    src?: string;
    onClick?: () => void;
    onClose?: () => void;
}

// 图片成员
export default function ImgItem(props: Iprops) {

    const dom = useRef<HTMLDivElement | null>(null);

    useEffect(() => {

    }, []);

    useEffect(() => autorun(() => {

    }, { delay: 10 }), []);

    return (
        <div
            ref={dom}
            className={styles.imgItem}
        >
            {
                props.src &&
                <span
                    className={styles.close}
                    onClick={props.onClose}
                >
                    <CloseOutlined />
                </span>
            }
            <img
                alt=""
                className={styles.img}
                src={props.src || updataPNG}
                onClick={props.onClick}
            />
        </div>
    );

}